Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pages Project and Domains #476

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

Cyb3r-Jak3
Copy link

Adds support for generating and importing cloudflare_pages_project resource. Adds support for generating cloudflare_pages_domain (importing would be a nightmare to implement).

@Cyb3r-Jak3 Cyb3r-Jak3 marked this pull request as draft October 22, 2022 20:53
@@ -688,6 +688,57 @@ func generateResources() func(cmd *cobra.Command, args []string) {
}
}
}

case "cloudflare_pages_domain":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i a bit confused here. why do we fetch all the pages projects and then iterate all of them to get pages domains?

ideally, these methods should fetch all the results from a single endpoint and use that to dump the output. we shouldn't need to make additional calls or build other structs in order to generate a single resource output.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because there is no endpoint to list all Pages Domains. The endpoint to list pages domains (https://api.cloudflare.com/#pages-domains-get-domains) requires a parameter of the project name, so I need to list all projects to then go through and get all domains.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! I just started using this tool and this is a missing feature I'd like to have. Is it possible to set the domain as a variable, instead of looking for every domain?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of generating is to get all the possible resources for output.

As an FYI, I haven't worked on in this in a while as I've run into issues with the pages project part.

Copy link

@perroboc perroboc Jun 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking it could be alike to the DNS resources: I have to call it for each zone separately.

So if it worked like the DNS resources, I would just call it per domain.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API doesn't work that way. DNS records are zone level which are seperated. Pages are account level resources, so they include all domains for all zones in the account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants